import Taro, { Component } from "@tarojs/taro";
import {Swiper,SwiperItem,Image,View,Text,Input,} from "@tarojs/components";
import "../../assets/common.scss";
import CommonJs from "../../utils/common";
import Hearder from "./hearder";
import "./hongbao.scss";

export default class Index extends Component {
  constructor(props) {
    super(props);
    this.state = {
      list: [],
      
    };
  }
  config = {
    navigationBarTitleText: "红包记录",
  };
  open(url,type) {
    this.$preload({
		  type:type,
	    })
    CommonJs.openTo(url);
  }
  componentWillMount() {
    this.getdate();
  }
  componentDidShow() {}
 
  getdate() {
    var _this = this;
    var url='/redbags/papi/v1.9/face-value/redEnvelopes/help'
    CommonJs.ajaxRequest(url, "", "GET", function(res) {
      _this.setState({
        list: res.data
      });
    },'wfw');
  }

  render() {
    const list = this.state.list;
    return (
      <View className="page"> 
		  	<View className="hbpage">
		  		<View className='typedl-box'>
		  		{list&&list.map((item, index) => (
	    			<View className='typedl'>
	    				<View className='typedt'><Image className="img" mode="widthFix" src={item.profilePicture?item.profilePicture:CommonJs.getlogo()}></Image></View>
	    				<View className='typedd'>
	    					<View className='spanh3'>{item.nickName}</View>
	    					<View className='spanp'>{CommonJs.FormatDate(item.createAt,3)}</View>
	    				</View>
	    				<View className='typeright'>
	    					<View className='typeh3'>+{item.money/100}<Text className='text'>({item.faceValue.remarks})</Text></View>
	    				</View>
	    			</View>
	    			))}
	    		</View>
	    		
		  	</View>
      </View>
    );
  }
}
